home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / bash / bash_108 / bash-108.zoo / lib+ / lib-plus.c next >
Encoding:
C/C++ Source or Header  |  1991-09-12  |  1.5 KB  |  94 lines

  1. /** 
  2.  ** (sjk)++ These routines are a bunch of fake outs for various eunchs
  3.  **         routines that are not present on the Atari ST
  4.  **/
  5.  
  6. #include <errno.h>
  7. #include <fcntl.h>
  8. #include <sys/time.h>
  9. #include <sys/resource.h>
  10. #include "r-res.h"
  11.  
  12.  
  13. /** 
  14.  ** (sjk)++ Set up a 128K initial stack for Bash to nosh on.
  15.  **/
  16.  
  17. extern long _initial_stack;
  18. long _initial_stack = 128 * 1024L;
  19.  
  20. static char default_host[] = " Atari-ST ";
  21.  
  22. int getdtablesize()
  23.   return(__NHANDLES); 
  24. }
  25.  
  26. char *gethostname()
  27.   char *ptr;
  28.   ptr = (char *)getenv("HOST");
  29.   if ( ptr == (char *)0 ) return(default_host);
  30.      else return(ptr);
  31. }
  32.  
  33. int sigblock(x)
  34. int x;
  35.   return(1); 
  36. }
  37.  
  38. int sigmask()
  39.   return(0); 
  40. }
  41.  
  42. int sigsetmask(x)
  43. int x;
  44.   return(0); 
  45. }
  46.  
  47.  
  48. /** 
  49.  ** (sjk)++ Some very weak inplimentation of the ulimit functions.
  50.  **/
  51.  
  52. int
  53. getrlimit(int resource, struct rlimit *rlp)
  54. {
  55.     if(!rlp) {
  56.         errno = EFAULT;
  57.         return -1;
  58.     }
  59.     switch(resource) {
  60.           case RLIMIT_CPU :
  61.           case RLIMIT_FSIZE : {
  62.               rlp->rlim_cur = rlp->rlim_max = RLIM_INFINITY;
  63.               break;
  64.           }
  65.           case RLIMIT_DATA :
  66.           case RLIMIT_STACK :
  67.           case RLIMIT_RSS : {
  68.               rlp->rlim_cur = rlp->rlim_max = (int) rlp - sbrk(0);
  69.               break;
  70.           }
  71.           case RLIMIT_CORE : {
  72.               rlp->rlim_cur = rlp->rlim_max = 0;
  73.               break;
  74.           }
  75.     }
  76.     return 0;
  77. }
  78.  
  79. int
  80. setrlimit(int resource, struct rlimit *rlp)
  81. {
  82.     if(!rlp) {
  83.         errno = EFAULT;
  84.         return -1;
  85.     }
  86.     /* setting resource limits is not implemented */
  87.     return 0;
  88. }
  89.